home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / EnterAct 3.5 / Drag_on Modules / hAWK programs / $SortTest < prev    next >
Encoding:
Text File  |  1991-11-03  |  350 b   |  16 lines  |  [TEXT/KEEN]

  1. # $SortTest - test the builtin sort command
  2.  
  3.  
  4. BEGIN {    s = "apples:pears:oranges:bananas"
  5.         n = split(s,a,":");
  6.         print "original array:"
  7.         for (i = 1; i <= n; ++i)
  8.             print a[i]
  9.         max = sort(a,ind,"d");#dictionary order
  10.         print "now sorted:"
  11.         print "max is", max
  12.         for (i in ind)
  13.             print i, ind[i]
  14.         for (i = 1; i <= max; ++i)
  15.             print a[ind[i]]
  16.     }